﻿using UnityEngine;
using System.Collections;
public enum Avater_Part
{
	head,
	body,
	hand_l,
	hand_r,
	leg_l,
	leg_r,
	weapon_l,
	weapon_r
};


public class Avater : MonoBehaviour {

	public MeshFilter head;
	public MeshFilter body;
	public MeshFilter hand_l;
	public MeshFilter hand_r;
	public MeshFilter leg_l;
	public MeshFilter leg_r;
	public MeshFilter weapon_l;
	public MeshFilter weapon_r;

	public void Change_avater(Avater_Part part,string model_id = null)
	{
		Mesh mesh = null;
		if (model_id != null) 
		{
			mesh = Resources.Load<Mesh>("model/"+model_id);
		}
		switch (part) 
		{
			case Avater_Part.weapon_l:
			  weapon_l.mesh = mesh;
			  break;
			case Avater_Part.weapon_r:
			  weapon_r.mesh = mesh;
			  break;
			case Avater_Part.head:
			  head.mesh = mesh;
			  break;
			case Avater_Part.body:
			  body.mesh = mesh;
			  break;
			case Avater_Part.hand_l:
			  hand_l.mesh = mesh;
			  break;
			case Avater_Part.hand_r:
			  hand_r.mesh = mesh;
			  break;
			case Avater_Part.leg_l:
			  leg_l.mesh = mesh;
			  break;
			case Avater_Part.leg_r:
			  leg_r.mesh = mesh;
			  break;
			default:
			  
			  break;
		}
	}



	// Use this for initialization
	void Start () {
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
